package com.dgw.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.dgw.entity.User;
import com.dgw.mapper.UserMapper;
import com.dgw.service.LoginService;
import com.dgw.utils.Encrypt;

@Service
public class LoginServiceImpl implements LoginService {
	
	@Autowired
	private UserMapper userMapper;
	
	@Override
	public User login(String username, String password) {
		User user = userMapper.selectByUsername(username);
		String md5 = Encrypt.md5(password, username);
		if(user.getPassword().equals(md5)){
			return user;
		}
		return null;
	}
}
